from toee import *
from utilities import *

def san_dying( attachee, triggerer ):
	game.global_vars[996] = 6
	return RUN_DEFAULT

def switch_to_kenan( attachee, triggerer, line):
	npc = find_npc_near(attachee,8804)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
	return SKIP_DEFAULT

def switch_to_sharar( attachee, triggerer, line):
	npc = find_npc_near(attachee,8806)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
	return SKIP_DEFAULT

def switch_to_gadham( attachee, triggerer, line):
	npc = find_npc_near(attachee,8807)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
	return SKIP_DEFAULT

def switch_to_abaddon( attachee, triggerer, line):
	npc = find_npc_near(attachee,8808)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
	return SKIP_DEFAULT

def switch_to_gershom( attachee, triggerer, line):
	npc = find_npc_near(attachee,8810)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
	return SKIP_DEFAULT

def switch_to_kent( attachee, triggerer, line):
	npc = find_npc_near(attachee,8071)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_meleny( attachee, triggerer, line):
	npc = find_npc_near(attachee,8015)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_riana( attachee, triggerer, line):
	npc = find_npc_near(attachee,8058)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_fruella( attachee, triggerer, line):
	npc = find_npc_near(attachee,8067)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_serena( attachee, triggerer, line):
	npc = find_npc_near(attachee,8056)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_pishella( attachee, triggerer, line):
	npc = find_npc_near(attachee,8069)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def switch_to_kella( attachee, triggerer, line):
	npc = find_npc_near(attachee,8070)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc, line)
		npc.turn_towards(attachee)
	return SKIP_DEFAULT

def pick_to_grope( attachee, triggerer ):
	if anyone( triggerer.group_list(), "has_follower", 8015 ):
		triggerer.begin_dialog( attachee, 70 )
	elif anyone( triggerer.group_list(), "has_follower", 8058 ):
		triggerer.begin_dialog( attachee, 100 )
	elif anyone( triggerer.group_list(), "has_follower", 8067 ):
		triggerer.begin_dialog( attachee, 80 )
	elif anyone( triggerer.group_list(), "has_follower", 8056 ):
		triggerer.begin_dialog( attachee, 90 )
	elif anyone( triggerer.group_list(), "has_follower", 8069 ):
		triggerer.begin_dialog( attachee, 260 )
	elif anyone( triggerer.group_list(), "has_follower", 8070 ):
		triggerer.begin_dialog( attachee, 270 )
	else:
		triggerer.begin_dialog( attachee, 110 )
	return SKIP_DEFAULT

def create_skel( attachee, triggerer ):
	skel = game.obj_create(14600, location_from_axis( 511, 588 ))
	skel.rotation = 1.0
	game.particles( "mon-Zombie-Unconceal", skel )
	game.particles( "ef-splash", skel )
	game.particles( "Mon-EarthElem-body120", skel )
	return RUN_DEFAULT

def kill_pc_1( attachee, triggerer ):
	pc = game.party[1]
	pc.critter_kill_by_effect()
	game.particles( "sp-Slay Living", pc )
	game.particles( "ef-MinoCloud", pc )
		# damage_dice = dice_new( '104d20' )
		# obj.damage( OBJ_HANDLE_NULL, 0, damage_dice )
	return 1

def kill_pc_2( attachee, triggerer ):
	pc = game.party[2]
	pc.critter_kill_by_effect()
	game.particles( "sp-Disintegrate-Hit", pc )
	game.particles( "ef-MinoCloud", pc )
		# damage_dice = dice_new( '104d20' )
		# obj.damage( OBJ_HANDLE_NULL, 0, damage_dice )
	return 1

def dom_mon( attachee, triggerer ):
	pc = game.party[0]
	game.particles( "sp-Charm Monster", pc )
	game.particles( "swirled gas", pc )
	game.particles( "cast-Enchantment-cast", attachee )
	kenan = find_npc_near(attachee,8804)
	sharar = find_npc_near(attachee,8806)
	gadham = find_npc_near(attachee,8807)
	abaddon = find_npc_near(attachee,8808)
	gershom = find_npc_near(attachee,8810)
	kenan.turn_towards(attachee)
	sharar.turn_towards(attachee)
	gadham.turn_towards(attachee)
	abaddon.turn_towards(attachee)
	gershom.turn_towards(attachee)
	return RUN_DEFAULT

def dom_mon_end( attachee, triggerer ):
	pc = game.party[0]
	game.particles( "Fizzle", pc )
	game.particles( "Gaseous Swirly", pc )
	game.particles( "Fizzle", attachee )
	return RUN_DEFAULT

def kent_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	kent = find_npc_near(attachee,8071)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", kent )
	kent.move( location_from_axis( 507, 587 ) )
	kent.turn_towards(tarah)
	tarah.turn_towards(kent)
	return

def kella_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	kella = find_npc_near(attachee,8070)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", kella )
	kella.move( location_from_axis( 507, 589 ) )
	kella.turn_towards(tarah)
	tarah.turn_towards(kella)
	return

def meleny_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	meleny = find_npc_near(attachee,8015)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", meleny )
	meleny.move( location_from_axis( 507, 589 ) )
	meleny.turn_towards(tarah)
	tarah.turn_towards(meleny)
	return

def fruella_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	fruella = find_npc_near(attachee,8067)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", fruella )
	fruella.move( location_from_axis( 507, 589 ) )
	fruella.turn_towards(tarah)
	tarah.turn_towards(fruella)
	return

def riana_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	riana = find_npc_near(attachee,8058)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", riana )
	riana.move( location_from_axis( 507, 589 ) )
	riana.turn_towards(tarah)
	tarah.turn_towards(riana)
	return

def serena_see_tarah( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	serena = find_npc_near(attachee,8056)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", serena )
	serena.move( location_from_axis( 507, 589 ) )
	serena.turn_towards(tarah)
	tarah.turn_towards(serena)
	return

def pishella_see_vornis( attachee, triggerer ):
	tarah = find_npc_near(attachee,8805)
	pishella = find_npc_near(attachee,8069)
	game.particles( "cast-Conjuration-cast", tarah )
	game.particles( "sp-Dimension Door", pishella )
	pishella.move( location_from_axis( 507, 589 ) )
	pishella.turn_towards(tarah)
	tarah.turn_towards(pishella)
	return
